<template>
  <a-checkbox
    :checked="checked"
    :indeterminate="indeterminate"
    :disabled="disabled"
    @change="onChange"
  >
    <slot />
  </a-checkbox>
</template>

<script>
export default {
  name: 'DCheckbox',
  model: {
    prop: 'checked',
    event: 'changeValue'
  },
  props: {
    defaultChecked: {
      type: Boolean,
      default: false
    },
    checked: {
      type: Boolean,
      default: false
    },
    indeterminate: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    onChange(e) {
      this.$emit('change', e);
      this.$emit('changeValue', e.target.checked);
      this.$emit('update:checked', e.target.checked);
    }
  }
};
</script>

<style lang="scss" scoped></style>
